package org.dtrd.modules.evaluation.entity.bean;

import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.modules.evaluation.entity.po.DtrdEntEvaluationRdDiabetes;

import java.time.LocalDate;
import java.util.Date;

/**
 * @Author: QR
 * @Date: 2021/9/28-16:24
 */
@ApiModel("糖尿病风险评估量表数据")
@Data
public class DiabetesInfo {

    private Integer dataId;

    @ApiModelProperty(value = "患者ID")
    private Integer patientId;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "性别：1-男,2-女")
    private Integer gender;

    @ApiModelProperty(value = "出生年月日")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date birth;

    @ApiModelProperty(value = "年龄")
    private Integer age;

    @ApiModelProperty(value = "身高 cm")
    private Float height;

    @ApiModelProperty(value = "体重 kg")
    private Float weight;

    @ApiModelProperty(value = "腰围 cm")
    private Float waistline;

    @ApiModelProperty(value = "收缩压 mmHg")
    private Integer pressureSystolic;

    @ApiModelProperty(value = "糖尿病家族史（父母、兄弟姐妹、子女）：1-有,2-无,3-不知道")
    private Integer diabetesFamily;

    @ApiModelProperty(value = "总分")
    private Integer score;

    @ApiModelProperty(value = "输出内容")
    private String output;

    public DiabetesInfo parseFromPo(DtrdEntEvaluationRdDiabetes po) {
        this.setDataId(po.getDataId());
        this.setPatientId(po.getPatientId());
        this.setCreateTime(po.getCreateTime());
        this.setGender(po.getGender());
        Date birth = po.getBirth();
        this.setBirth(birth);
        this.setAge(DateUtil.ageOfNow(birth));
        this.setHeight(po.getHeight());
        this.setWeight(po.getWeight());
        this.setWaistline(po.getWaistline());
        this.setPressureSystolic(po.getPressureSystolic());
        this.setDiabetesFamily(po.getDiabetesFamily());
        this.setScore(po.getScore());
        this.setOutput(po.getOutput());
        return this;
    }
}
